# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=Alien-Libxml2
pkgname=perl-${_realname}
pkgver=0.17
pkgrel=1
pkgdesc="Install the C libxml2 library on your system"
arch=('any')
license=('PerlArtistic')
url="https://metacpan.org/release/Alien-Libxml2"
groups=('perl-modules')
depends=('libxml2' 'perl-Alien-Build>=2.37')
makedepends=('perl-HTML-Parser' 'perl-Sort-Versions' 'perl-Test2-Suite' 'perl-URI' 'libxml2-devel')
options=(!emptydirs)
source=("https://cpan.metacpan.org/authors/id/P/PL/PLICEASE/${_realname}-${pkgver}.tar.gz")
options=(!emptydirs)
sha256sums=('73b45244f0b5c36e5332c33569b82a1ab2c33e263f1d00785d2003bcaec68db3')

prepare() {
  cd ${srcdir}/${_realname}-${pkgver}
}

build() {
  cd ${srcdir}/${_realname}-${pkgver}

  # install module in vendor directories.
  perl Makefile.PL -- INSTALLDIRS=vendor
  make
}

check() {
  cd ${_realname}-${pkgver}
  make test
}

package() {
  cd ${srcdir}/${_realname}-${pkgver}

  make install DESTDIR=${pkgdir}
  # Remove .packlist and perllocal.pod files.
  find "$pkgdir" -name '.packlist' -delete
  find "$pkgdir" -name 'perllocal.pod' -delete
}
